<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0,minimum-scale=1.0,maximum-scale=1.0" />
    <meta name="author" content="火星科技 http://mars3d.cn " />
    <meta name="apple-touch-fullscreen" content="yes" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="x5-fullscreen" content="true" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
    <!-- 标题及搜索关键字 -->
    <meta name="keywords" content="火星科技,cesium,3D,GIS,marsgis,三维,地球,地图,开发,框架,系统,示例,资料,模型,离线,外包,合肥,安徽,中国" />
    <meta
      name="description"
      content="火星科技 合肥火星 合肥火星科技 合肥火星科技有限公司 leaflet leaflet框架 leaflet开发 cesium cesium开发 cesium框架 三维 地球 模型  gis marsgis 地图离线 地图开发 地图框架 地图外包 框架 开发 外包  地图离线 二维地图 三维地图 全景漫游 地理信息系统 云GIS 三维GIS GIS平台 WebGIS"
    />

    <link rel="shortcut icon" type="image/x-icon" href="http://mars3d.cn/favicon.ico" />
    <title>泛光特效 | Mars3D | 三维地图 | 火星科技 | 合肥火星科技有限公司</title>

    <!--第三方lib-->
    <script
      type="text/javascript"
      src="../lib/include-lib.js"
      libpath="../lib/"
      include="jquery,font-awesome,bootstrap,bootstrap-checkbox,bootstrap-slider,layer,haoutil,turf,mars3d"
    ></script>

    <link href="css/style.css" rel="stylesheet" />
  </head>

  <body class="dark">
    <!--加载前进行操作提示，优化用户体验-->
    <div id="mask" class="signmask" onclick="removeMask()"></div>

    <div id="mars3dContainer" class="mars3d-container"></div>

    <!-- 面板 -->
    <div class="infoview">
      <table class="mars-table">
        <tr>
          <td>状态</td>
          <td>
            <div class="checkbox checkbox-primary checkbox-inline">
              <input id="chkShowEffect" class="styled" type="checkbox" checked />
              <label for="chkShowEffect"> 开启效果 </label>
            </div>
          </td>
        </tr>

        <tr>
          <td>对比度</td>
          <td>
            <input id="txt_contrast" />
          </td>
        </tr>
        <tr>
          <td>亮度</td>
          <td>
            <input id="txt_brightness" />
          </td>
        </tr>
        <tr>
          <td>增量</td>
          <td>
            <input id="txt_delta" />
          </td>
        </tr>
        <tr>
          <td>步长</td>
          <td>
            <input id="txt_stepSize" />
          </td>
        </tr>
        <tr>
          <td>Sigma</td>
          <td>
            <input id="txt_sigma" />
          </td>
        </tr>
      </table>
    </div>

    <script src="./js/common.js"></script>
    <script type="text/javascript">
      "use script"; //开发环境建议开启严格模式

      var map;

      function initMap(options) {
        //合并属性参数，可覆盖config.json中的对应配置
        var mapOptions = mars3d.Util.merge(options, {
          scene: {
            center: { lat: 31.825314, lng: 117.242517, alt: 3195, heading: 29, pitch: -39 },
          },
          layers: [
            {
              type: "geojson",
              name: "道路线",
              url: "//data.mars3d.cn/file/geojson/hefei-road.json",
              symbol: {
                styleOptions: {
                  materialType: "PolylineGlow",
                  glowPower: 0.2,
                  color: "#FF4500",
                  width: 12,
                  opacity: 0.8,
                },
              },
              popup: "{name}",
              show: true,
            },
            {
              type: "geojson",
              name: "河流(面状)",
              url: "//data.mars3d.cn/file/geojson/hefei-water.json",
              symbol: {
                type: "water",
                styleOptions: {
                  normalMap: "img/textures/waterNormals.jpg", // 水正常扰动的法线图
                  frequency: 5000.0, // 控制波数的数字。
                  animationSpeed: 0.05, // 控制水的动画速度的数字。
                  amplitude: 9.0, // 控制水波振幅的数字。
                  specularIntensity: 0.8, // 控制镜面反射强度的数字。
                  baseWaterColor: "#00baff", // rgba颜色对象基础颜色的水。#00ffff,#00baff,#006ab4
                  blendColor: "#00baff", // 从水中混合到非水域时使用的rgba颜色对象。
                  // clampToGround: true,
                },
              },
              popup: "{name}",
              show: true,
            },
          ],
        });

        //创建三维地球场景
        map = new mars3d.Map("mars3dContainer", mapOptions);

        map.basemap = 2017; //切换至蓝色底图

        //添加参考三维模型
        var tiles3dLayer = new mars3d.layer.TilesetLayer({
          name: "合肥市建筑物",
          url: "//data.mars3d.cn/3dtiles/jzw-hefei/tileset.json",
          maximumScreenSpaceError: 1,
          maximumMemoryUsage: 1024,
          marsJzwStyle: true, //打开建筑物特效（内置Shader代码）
          highlight: { type: "click", color: "#FFFF00" },
          popup: [
            { field: "objectid", name: "编号" },
            { field: "name", name: "名称" },
            { field: "height", name: "楼高", unit: "米" },
          ],
        });
        map.addLayer(tiles3dLayer);

        //构造效果
        var bloomEffect = new mars3d.effect.BloomEffect();
        map.addEffect(bloomEffect);

        $("#chkShowEffect").change(function () {
          var val = $(this).is(":checked");

          bloomEffect.enabled = val;
        });

        $("#txt_contrast")
          .slider({ min: -255.0, max: 255.0, step: 0.01, value: 128 })
          .on("change", (e) => {
            if (e?.value) {
              bloomEffect.contrast = e.value.newValue;
            }
          });
        $("#txt_brightness")
          .slider({ min: -1.0, max: 3.0, step: 0.01, value: -0.3 })
          .on("change", (e) => {
            if (e?.value) {
              bloomEffect.brightness = e.value.newValue;
            }
          });
        $("#txt_delta")
          .slider({ min: 1, max: 5, step: 0.01, value: 1.0 })
          .on("change", (e) => {
            if (e?.value) {
              bloomEffect.delta = e.value.newValue;
            }
          });
        $("#txt_sigma")
          .slider({ min: 1, max: 10, step: 0.01, value: 3.78 })
          .on("change", (e) => {
            if (e?.value) {
              bloomEffect.sigma = e.value.newValue;
            }
          });
        $("#txt_stepSize")
          .slider({ min: 0, max: 7, step: 0.01, value: 5.0 })
          .on("change", (e) => {
            if (e?.value) {
              bloomEffect.stepSize = e.value.newValue;
            }
          });
      }
    </script>
  </body>
</html>
